/**
 * 接口请求函数库
 */

import server from './server'


// 登录
export const reqLogin = (username, pwd) => server.post('/admin/login', {
    username,
    pwd
})

// 获取用户信息
export const reqInfo = () => server('/admin/info')

// 退出登录
export const reqLogout = () => server('/admin/logout')

// 添加用户
export const reqAddUser = user => server.post('/admin/user', user)

// 获取用户列表
export const reqUserList = (page, limit) => server(`/admin/user/${page}/${limit}`)

// 获取用户
export const reqUser = id => server('/admin/user', {
    params: {
        id
    }
})

// 更新用户
export const reqUpdateUser = formData => server.put('/admin/user', formData)

// 删除用户
export const reqDelUser = id => server.delete(`/admin/user/${id}`)